package com.wave.spring.web.controller;

import com.wave.spring.dto.DemoObj;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

@RestController
@RequestMapping("/rest")
public class DemoRestController {




    @RequestMapping(value = "get",produces = "application/json;charset=UTF-8")
    public String get(DemoObj obj){
        obj.setNow(new Date());
        obj.setFormart("json");
        return obj.toString();
    }

    @RequestMapping(value = "getjson",produces = "application/json;charset=UTF-8")
    public DemoObj getjson(DemoObj obj){
        obj.setNow(new Date());
        obj.setFormart("json");
        return obj;
    }

    @RequestMapping(value = "getxml",produces = "application/xml;charset=UTF-8")
    public DemoObj getxml(DemoObj obj){
        obj.setNow(new Date());
        obj.setFormart("xml");
        return obj;
    }




}
